package com.shixi.shixitraining.shixitraining.base;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.shixi.shixitraining.shixitraining.util.LoadingUtil;

/**
 * fragment基类
 * Created by shenyan on 2018/7/5.
 */

public abstract class   BaseFragment extends Fragment {

    public View mContentView;
    private LoadingUtil loadingUtil;
    private Context mContext;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        mContentView = inflater.inflate(getlayoutId(), container, false);
        initPager();
        return mContentView;

    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        mContext = context;
    }

    @Override
    public void onStart() {
        super.onStart();
        loadingUtil = new LoadingUtil();
//        loadingUtil.showLoadingDialog(getContext());
    }

    /**
     * 返回界面的布局
     * @return
     */
    protected abstract int getlayoutId();

    /**
     * 初始化界面
     */
    protected  abstract void  initPager();

    @Override
    public void onDestroy() {
        super.onDestroy();
//        loadingUtil.dismissLoadingDialog();
    }
}
